package com.shudai.largescreen.controller;

import com.shudai.largescreen.common.R;
import com.shudai.largescreen.service.PinCrownService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api/")
@Api(tags = "销售看板",value = "销售看板")
@RequiredArgsConstructor
public class PinCrownController {


    private final PinCrownService pinCrownService;

    @ApiOperation("销冠排名看板")
    @PostMapping(value = "/champion-board/rank-salesman")
    public R getTopSaleStatic(){
        Map<String,Object> map = new HashMap<>();
        map.put("chartData", pinCrownService.getTopSaleStatic());
       return R.ok(map);
    }


    @ApiOperation("经销商 -  本周业绩排行")
    @PostMapping(value = "/champion-board/rank-distributor")
    public R getTopDistributorStatic(){
        Map<String,Object> map = new HashMap<>();
        map.put("chartData",  pinCrownService.getTopDistributorStatic());
        return R.ok(map);
    }

    @ApiOperation("区域筛选器")
    @PostMapping(value = "/public/filter-area")
    public R getRegionalFiltering(){
        return R.ok(pinCrownService.getRegionalFiltering());
    }

    @ApiOperation("业务员筛选器")
    @PostMapping(value = "/public/filter-sales_man")
    public R getSalesMan(){
        return R.ok(pinCrownService.getSalesMan());
    }


}
